package com.song;

import com.song.config.SpringConfig;
import com.song.dao.SequenceDao;
import org.mybatis.spring.mapper.MapperFactoryBean;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @Description: SpringMybatisTest：类描述
 * @author: songzhangyong
 * @Date: 2019/11/9 21:14
 */
public class SpringMybatisTest {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext anno = new AnnotationConfigApplicationContext(SpringConfig.class);
//        Object object =  anno.getBean(SequenceDao.class).query();
//        System.out.println(object.toString());

        SpringConfig bean = anno.getBean(SpringConfig.class);
        bean.getSequenceDao().query() ;

        SequenceDao sequenceDao =  anno.getBean(SequenceDao.class);
        sequenceDao.query();
        sequenceDao.query();

          // com.sun.proxy.$Proxy18
          // com.sun.proxy.$Proxy18
          // org.mybatis.spring.mapper.MapperFactoryBean

        System.out.println(anno.getBean(SequenceDao.class).getClass().getTypeName());
        System.out.println(anno.getBean("sequenceDao").getClass().getTypeName());
        System.out.println(anno.getBean("&sequenceDao").getClass().getTypeName());

        MapperFactoryBean factoryBean = (MapperFactoryBean) anno.getBean("&sequenceDao");
        System.out.println(factoryBean.getObjectType());


    }
}
